import request from '@/utils/request-unimall'
import Qs from 'qs'

export function listFreight() {
  return request({
    method: 'get',
    url: "/web/admin-freight/list",
    params: {
      // _gp: 'admin.freight',
      // _mt: 'list',
      adminId: 0
    }
  })
}

export function createFreight(query) {
  return request({
    method: 'post',
    url: "/web/admin-freight/create",
    data: Qs.stringify({
      // _gp: 'admin.freight',
      // _mt: 'create',
      ...query,
      carriageDOList: JSON.stringify(query.carriageDOList)
    })
  })
}

export function deleteFreight(query) {
  return request({
    method: 'post',
    url: "/web/admin-freight/delete",
    data: Qs.stringify({
      // _gp: 'admin.freight',
      // _mt: 'delete',
      id: query
    })
  })
}

export function updateFreight(query) {
  return request({
    method: 'post',
    url: "/web/admin-freight/edit",
    data: Qs.stringify({
      // _gp: 'admin.freight',
      // _mt: 'edit',
      ...query,
      carriageDOList: JSON.stringify(query.carriageDOList)
    })
  })
}
